package com.blb.edugatewayservice.filter;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.SetOperations;

import javax.annotation.Resource;
import java.util.List;
import java.util.Set;

/**
 * 读取配置文件白名单
 */
//@ConfigurationProperties(prefix = "study")
@Configuration
public class WhiteListConfigProperties {

//    private List<String> whiteList;
//
//    public void setWhiteList(List<String> whiteList) {
//        this.whiteList = whiteList;
//    }
//
//    public List<String> getWhiteList() {
//        return whiteList;
//    }

    @Autowired
    private RedisTemplate<String,String> redisTemplate;

    public Set<String> getWhiteList(){
        SetOperations<String, String> ops = redisTemplate.opsForSet();
        Set<String> members = ops.members("white-list");
        return members;
    }
}
